package fr.univ.surveyonline.model;

import org.junit.rules.ExpectedException;

import org.junit.*;

import static org.junit.Assert.*;


public class TestResponse {

	// TESTED OBJECT
	private Response response;
	
	@Rule
	public ExpectedException thrown = ExpectedException.none();
	
	@Before
	public void setUp() {
		this.response = new Response();
	}
	
	@Test
	public void testSetSuvey_01() {
		thrown.expect(IllegalArgumentException.class);
		this.response.setSurvey(null);
	}
	
	@Test
	public void testSetSuvey_02_1() {
		// TODO
	}
	
	@Test
	public void testSetSuvey_02_2() {
		// TODO
	}
	
	@Test
	public void testSetMembre_01() {
		User membre = new User();
		this.response.setMembre(membre);
		assertEquals(membre, this.response.getMembre());
	}
	
	@Test
	public void testSetResponse_01_1() {
		String response = null;
		thrown.expect(IllegalArgumentException.class);
		this.response.setResponse(response);
	}
	
	@Test
	public void testSetResponse_01_2() {
		String response = "";
		thrown.expect(IllegalArgumentException.class);
		this.response.setResponse(response);
	}
	
	@Test
	public void testSetResponse_02_1() {
		String response = "Oui";
		this.response.setResponse(response);
		assertEquals(response, this.response.getResponse());
	}
	
	@Test
	public void testSetResponse_02_2() {
		String response = "Non";
		this.response.setResponse(response);
		assertEquals(response, this.response.getResponse());
	}
	
	@Test
	public void testSetResponse_02_3() {
		String response = "Chat";
		this.response.setResponse(response);
		assertEquals(response, this.response.getResponse());
	}
	
	@Test
	public void testSetResponse_02_4() {
		String response = "18";
		this.response.setResponse(response);
		assertEquals(response, this.response.getResponse());
	}
	
	@Test
	public void testSetResponse_02_5() {
		String response = "40000";
		this.response.setResponse(response);
		assertEquals(response, this.response.getResponse());
	}
}
